package com.foreknow.demo3;

import java.util.Random;
import java.util.Scanner;

/**
 * 10.17-10.22周测
 */
public class LittleTest1<avg> {
    public static void main(String[] args) {
        //二-1
        int a = 1;
        double b = 2.0;
        a = (int) b;
        System.out.println(a);

        //三-1
        Scanner input = new Scanner(System.in);
        int first = input.nextInt();
        int second = input.nextInt();
        if (first>second){
            System.out.println("最大值为：" + first);
        } else {
            System.out.println("最大值为：" + second);
        }

        //三-2
        int[] num2 = {10,20,30,40,50};
        for(int i = 0;i<num2.length;i++){
            System.out.println(num2[i]);
        }

        //三-3
        int[] num3 = { 18,25,7,36,13,2,89,63};
        int max = num3[0];
        int i = 0;
        for (i = 1;i<num3.length;i++){
            if (num3[i]>max){
                max = num3[i];
            }
        }
        System.out.println("最大的数为：" + max);
        System.out.println("下标为：" + (i-2));

        //三-4
        int[] num4 = { -10,2,3,246,-100,0,5};
        int max1 = num4[0];
        for (int i4 = 1;i4<num4.length;i4++){
            if (num4[i4]>max1){
                max1 = num4[i4];
            }
        }
        System.out.println("最大值为："+max);
        int min = num4[0];
        for (int a4 = 1;a4<num4.length;a4++){
            if (num4[a4]<min){
                min = num4[a4];
            }
        }
        System.out.println("最小值为："+min);
        int sum = 0;
        int pjz = 0;
        for (int b4 = 0;b4<num4.length;b4++){
            sum += b4;
            pjz = sum/7;
        }
        System.out.println("平均值为："+pjz);

    //三-5 完成抽奖功能(随机生成5个随机数并保存到数组中，用数据中的数据与用户生成的四位随机数是否相同，如果相同为幸运会员)
        Random rand = new Random();
        int lucky = rand.nextInt(10000);
        System.out.println("您的随机数为"+lucky);
        int[] whatever = new int[5];
        int m = 0;
        for (m=0;m<whatever.length;m++) {
            int suijishu = rand.nextInt(10000);
            whatever[m] = suijishu;
            System.out.println("第" + (m + 1) + "个随机数为：" + whatever[m]);
            if (lucky == whatever[m]) {
                System.out.println("恭喜您成为幸运会员！");
            } else {
                System.out.println("Sorry！！");
            }
        }
        int g = 6;
        int j = 0;
        j = g++;
        j = ++g;
        j = j--;
        j = --g;
        System.out.println(g);
        System.out.println(j);
}
}
